<?php
/*
 * @@Copyright (C), 2021-2022: 恒盛时代
 * @Author: zhouzhou
 * @Date: 2021/12/8
 * @Description:im状态表
 */

namespace App\Models;

use Illuminate\Database\Eloquent\SoftDeletes;

class ImCondition extends BaseModel
{
    protected $table = 'im_condition';
    protected $hidden = ['created_at','updated_at'];


    /**
     * @desc 获取所有状态
     * @param int $userId 用户id
     * @return mixed
     * @author zhouzhou
     * @time 2021/12/28 16:50
     */
    public function conditionList($userId = 0)
    {
        $list = $this->select('id', 'img', 'note', 'type')
            ->orderBy('id', 'asc')
            ->get()->map(function($val) {
                switch (intval($val['type']))
                {
                    case 1:
                        $val['desc'] = '心情想法';
                        break;
                    case 2:
                        $val['desc'] = '工作学习';
                        break;
                    case 3:
                        $val['desc'] = '活动';
                        break;
                    case 4:
                        $val['desc'] = '休息';
                        break;
                    case 5:
                        $val['desc'] = '更多';
                        break;
                    default:
                        $val['desc'] = '';
                        break;
                }

                return $val;
            });

        return $list;
    }




}
